<template>
  <div class="bg-form">
    <el-form :model="addForm" label-width="80px" :show-message="false" :rules="addFormRules" ref="addForm">
      <el-row>
        <el-col :span="12">置换信息</el-col>
      </el-row>
      <el-divider content-position="center"></el-divider>
      <el-row>
        <el-col :span="6">
          <el-form-item label="置换车型:" prop="carModelName">
            <el-input disabled v-model="addForm.carModelName" clearable placeholder="置换车型"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="表显里程:" prop="mileage">
            <el-input disabled v-model="addForm.mileage" clearable placeholder="表显里程"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="首次上牌:" prop="firstLicenseTime">
            <el-input disabled v-model="addForm.firstLicenseTime" clearable placeholder="首次上牌"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="颜色:" prop="color">
            <el-input disabled v-model="addForm.color" clearable placeholder="颜色"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="排量:" prop="displacement">
            <el-input disabled v-model="addForm.displacement" clearable placeholder="排量"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="变速箱:" prop="gearbox">
            <el-select
              disabled
              class="w-100"
              clearable
              v-model="addForm.gearbox"
              placeholder="变速箱"
            >
              <el-option
                v-for="item in getDict(['变速箱'])['变速箱']"
                :key="item.index"
                :value="item.value"
                :label="item.text"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="交车时间:" prop="swopTime">
            <el-input disabled v-model="addForm.swopTime" clearable placeholder="交车时间"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="置换价:" prop="replacementPrice">
            <el-input disabled v-model="addForm.replacementPrice" clearable placeholder="置换价"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="客户手机:" prop="userPhone">
            <el-input disabled v-model="addForm.userPhone" clearable placeholder="客户手机"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="客户名称:" prop="userName">
            <el-input disabled v-model="addForm.userName" clearable placeholder="客户名称"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="置换类型:" prop="money">
            <el-select
              disabled
              class="w-100"
              clearable
              v-model="addForm.type"
              placeholder="置换类型"
            >
              <el-option
                v-for="item in getDict(['置换类型'])['置换类型']"
                :key="item.index"
                :value="item.value"
                :label="item.text"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="销售顾问:" prop="saleName">
            <el-input disabled v-model="addForm.saleName" clearable placeholder="销售顾问"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="备注:" prop="note">
            <el-input disabled v-model="addForm.note" clearable placeholder="请输入备注"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="创建人:" prop="money">
            <el-input disabled v-model="addForm.createdBy" clearable placeholder="创建人"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="创建时间:" prop="createTime">
            <el-input disabled v-model="addForm.createTime" clearable placeholder="创建时间"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
      <el-col :span="24" align="right">
        <el-button type="primary" @click="onSubmit">返回</el-button>
      </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import {
  detailById
} from '@/api/pre-sale/orderManagement/replacement'
import { getDict } from '@/utils/index'
export default {
  data() {
    return {
      getDict: getDict,
      addForm: {
        paymentTime: '',
        gearbox: ''
      },
      addFormRules: {}
    }
  },
  mounted() {
    this.getDetail()
  },
  methods: {
    // 保存
    onSubmit() {
      this.$router.go(-1)
    },
    async getDetail() {
      await detailById(this.$route.query.id).then((res) => {
        const { success, data } = res
        if (success) {
          this.addForm = {
            ...this.addForm,
            ...data

          }
          this.addForm.gearbox = data.gearbox + ''
        }
      })
    }
  }

}
</script>
<style lang="scss" scoped>
.bg-form {
  background: #ffffff;
  padding: 20px;
}
</style>

